import requests
from utils.loger import Log
class SDKClient:
    def __init__(self,method,data):
        self.method = method
        self.data = data
        self.logger = Log()

    def do_request(self,url):
        # with open('app.log',mode='a',encoding='utf8') as f:
        #     f.write(f'现在请求{url},请求数据为{self.data}')
        self.logger.info(f'现在开始请求{url}，请求方法为{self.method},请求数据为{self.data}')
        if self.method == 'get':
            return requests.get(url,params=self.data)
        elif self.method == 'post':
            return requests.post(url,json=self.data)
